<?php
class Exam extends IController {
    public function  email(){
        $this->redirect("email");
    }
    public function add(){
        $model=new IModel("lala");
        $name=IReq::get("name");
        $pwd=IReq::get("pwd");
        $email=IReq::get("email");
        $str=array('name'=>$name,'pwd'=>$pwd,'email'=>$email,'states'=>0);
        $model->setData($str);
        $res=$model->add();
        if($res){
            $title="欢迎您注册我们公司会员";
            $url="http://www.iwebshop.com/exam/yan/id/".base64_encode($res);
            $content="点击此处激活".$url;
            $mail=new SendMail();
            $mail->send($email,$title,$content);
        }
    }
    public function yan(){
        $id=$_GET['id'];
        $id=base64_decode($id);
        // print_r($id);die;
        $arr=array('state'=>1);
        $model=new IModel("lala");
        $model->setData($arr);
        $res=$model->update("id=$id");
        if($res){
            $this->redirect("login");
        }
    }
    public function login(){
        $name=IReq::get("name");
        $pwd=IReq::get("pwd");
        $model=new IModel("lala");
        $res=$model->query("name='$name' and pwd='$pwd'");
        $states=$res[0]['state'];
        if($states==1){
            echo "登陆成功";
        }else{
            echo "没有激活";
        }
    }
}